<?php

set_error_handler(function ($number, $message, $file, $line, $context) {
    throw new Exception($message);
});